# database.py
from flask_sqlalchemy import SQLAlchemy

# 创建 SQLAlchemy 实例时添加配置
db = SQLAlchemy(engine_options={
    'pool_size': 5,
    'pool_recycle': 3600,
    'pool_pre_ping': True,
    'max_overflow': 10,
    'pool_timeout': 3600,
    'connect_args': {
        'charset': 'utf8mb4',
        'autocommit': True,
        'connect_timeout': 3600,
        'read_timeout': 3600,
        'write_timeout': 3600
    }
})